xml element name prefix issue

madaxe2020

Well-known member
Joined
Sep 7, 2020
Messages
50
Programming Experience
5-10
i need to pass this xml but the problem is the std: prefix namespace on the xmlelements, if I strip the std: in notepad++ it deserializes fine is there a way to get around this

thanks

madaxe

xml:
<?xml version="1.0" ?>

<std:node name="S1_standard" xmlns:std="3D Design & Engineering Software - Dassault Systèmes®">

    <std:node name="Units">

        <std:node name="Length">

            <std:strval name="Length">mm</std:strval>

        </std:node>

        <std:node name="Angle">

            <std:strval name="Angle">deg</std:strval>

        </std:node>

    </std:node>

    <std:typedef name="SimpleHoleValues">

        <std:strval name="Name">S1</std:strval>

        <std:floatval name="MainDiameter">5.</std:floatval>

        <std:floatval name="MainDepth">10.</std:floatval>

        <std:floatval name="BottomAngle">110.</std:floatval>

        <std:floatval name="ThreadDiameter">6.</std:floatval>

        <std:floatval name="ThreadDepth">8.</std:floatval>

        <std:floatval name="Pitch">1.</std:floatval>

        <std:strval name="ThreadDescription">THD_S_01</std:strval>

    </std:typedef>

    <std:node name="SimpleHoleValues">

        <std:typeval name="SimpleHoleValues">

            <std:strval name="Name">S1</std:strval>

            <std:floatval name="MainDiameter">5.</std:floatval>

            <std:floatval name="MainDepth">10.</std:floatval>

            <std:floatval name="BottomAngle">105.</std:floatval>

            <std:floatval name="ThreadDiameter">6.</std:floatval>

            <std:floatval name="ThreadDepth">8.</std:floatval>

            <std:floatval name="Pitch">1.</std:floatval>

            <std:strval name="ThreadDescription">THD_S_01</std:strval>

        </std:typeval>

        <std:typeval name="SimpleHoleValues">

            <std:strval name="Name">STD_S_S2</std:strval>

            <std:floatval name="MainDiameter">6.</std:floatval>

            <std:floatval name="MainDepth">12.</std:floatval>

            <std:floatval name="BottomAngle">100.</std:floatval>

            <std:floatval name="ThreadDiameter">7.</std:floatval>

            <std:floatval name="ThreadDepth">10.</std:floatval>

            <std:floatval name="Pitch">1.05</std:floatval>

            <std:strval name="ThreadDescription">THD_S_02</std:strval>

        </std:typeval>

    </std:node>

</std:node>
 
Last edited:
Solution
i need to pass this xml but the problem is the std: prefix namespace on the xmlelements, if I strip the std: in notepad++ it deserializes fine is there a way to get around this

thanks

madaxe

xml:
<?xml version="1.0" ?>

<std:node name="S1_standard" xmlns:std="3D Design & Engineering Software - Dassault Systèmes®">

    <std:node name="Units">

        <std:node name="Length">

            <std:strval name="Length">mm</std:strval>

        </std:node>

        <std:node name="Angle">

            <std:strval name="Angle">deg</std:strval>

        </std:node>

    </std:node>

    <std:typedef name="SimpleHoleValues">

        <std:strval name="Name">S1</std:strval>

        <std:floatval name="MainDiameter">5.</std:floatval>...
i need to pass this xml but the problem is the std: prefix namespace on the xmlelements, if I strip the std: in notepad++ it deserializes fine is there a way to get around this

thanks

madaxe

xml:
<?xml version="1.0" ?>

<std:node name="S1_standard" xmlns:std="3D Design & Engineering Software - Dassault Systèmes®">

    <std:node name="Units">

        <std:node name="Length">

            <std:strval name="Length">mm</std:strval>

        </std:node>

        <std:node name="Angle">

            <std:strval name="Angle">deg</std:strval>

        </std:node>

    </std:node>

    <std:typedef name="SimpleHoleValues">

        <std:strval name="Name">S1</std:strval>

        <std:floatval name="MainDiameter">5.</std:floatval>

        <std:floatval name="MainDepth">10.</std:floatval>

        <std:floatval name="BottomAngle">110.</std:floatval>

        <std:floatval name="ThreadDiameter">6.</std:floatval>

        <std:floatval name="ThreadDepth">8.</std:floatval>

        <std:floatval name="Pitch">1.</std:floatval>

        <std:strval name="ThreadDescription">THD_S_01</std:strval>

    </std:typedef>

    <std:node name="SimpleHoleValues">

        <std:typeval name="SimpleHoleValues">

            <std:strval name="Name">S1</std:strval>

            <std:floatval name="MainDiameter">5.</std:floatval>

            <std:floatval name="MainDepth">10.</std:floatval>

            <std:floatval name="BottomAngle">105.</std:floatval>

            <std:floatval name="ThreadDiameter">6.</std:floatval>

            <std:floatval name="ThreadDepth">8.</std:floatval>

            <std:floatval name="Pitch">1.</std:floatval>

            <std:strval name="ThreadDescription">THD_S_01</std:strval>

        </std:typeval>

        <std:typeval name="SimpleHoleValues">

            <std:strval name="Name">STD_S_S2</std:strval>

            <std:floatval name="MainDiameter">6.</std:floatval>

            <std:floatval name="MainDepth">12.</std:floatval>

            <std:floatval name="BottomAngle">100.</std:floatval>

            <std:floatval name="ThreadDiameter">7.</std:floatval>

            <std:floatval name="ThreadDepth">10.</std:floatval>

            <std:floatval name="Pitch">1.05</std:floatval>

            <std:strval name="ThreadDescription">THD_S_02</std:strval>

        </std:typeval>

    </std:node>

</std:node>

add namespace to the xml classes as shown below

C#:
    [XmlRoot(ElementName = "node",Namespace = "http://www.dsweb.com/std")]
    public class Node
 
Solution
Back
Top Bottom