1

I have an unformatted XML file like this:

<ROOT>
    <A0>Hi</A0>
    <A1 A="hi" A="how" A="are" A="You?"></A1>
    <A2 A2="Bye"> </A2>
    <A3>In this tag have hexadecimal value</A3>
</ROOT>

Questions:

  1. how do I handle duplicate attribute name like in tag <A1> ?
  2. how do I handle hexadecimal values like in tag <A3> ?

I have to use this type of files as a source in a SSIS package.

Thanks

2
  • 5
    1. A well-formed XML document can't have identically-named attributes. 2. It isn't clear what you mean by "How handle Hexadecimal values " you haven't said exactly in what way you want these processed. Please, edit the question and make it more meaningful. Commented Apr 10, 2012 at 12:49
  • If that are your requirements, then your files are not XML-files ;). You will probably encounter lots of trouble if you try working with some existing parsers, and those that will work might eg. stop in next (or previous) version. I think I would try with some HTML-oriented parsers, as there are some crazy websites out there so they might not be so choosy about contents of your documents. Commented Jun 20, 2014 at 2:58

1 Answer 1

12
<ROOT>
  <A0>Hi</A0>
  <A1 A="hi" A="how" A="are" A="You?"></A1>
  <A2 A2="Bye"> </A2>
  <A3>In this tag have Hexa deimal value </A3>
</ROOT>

Duplicate attributes (on the same element) are not allowed in a well-formed XML document by definition.

Therefore the provided text isn't an XML document, cannot be parsed by any compliant XML parser -- and therefore, the described problem cannot exist.

Sign up to request clarification or add additional context in comments.

6 Comments

Thanks for quick reply. Is there any solution to over come Hexadecimal values Like (^ not exact somthing like reverse L shape).
@ram.bi: You haven't described at all what processing of hexadecimal values you want.
From my source XML i am getting some hexadecimal values (Different symbols like reverse L etc,). XML Not processing those values how can i handle those?
Please, ask a new question. Provide a well-formed XML document (verify in advance that it is parsed without errors). Have exact text nodes and specify explicitly what are the unwanted characters and what characters you would like to have. Statements like "XML not processing those values" are confusing. What do you mean by this?
i am getting following error::Character ' ', hexadecimal value 0x2 is illegal in XML documents.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.