|
More detail - where does the HTML come in - that's NOT XML.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a tool called "Flat file to XML converter" to convert the text file information to XML file using the XSD template available. Text file contains employee details. Whenever a name with apostrphe(') comes the tool converts it as ' instead of '. So whenever the XML file is decoded to view, it is showing the name with '. Please help me in this.
To make any changes in the tool is not possible and no XSLT is available for the XML file. Only XSD is there. I need to validate this ' and replace it with ' Is it possible?
Only a change in XSD is allowed. No seperate application/tool to convert the XML is allowed.
Example:-
flat fle contains the name- O'NEIL, JOHN.
XML file after conversion - O 'NEIL, JOHN.
Output needed - O'NEIL, JOHN
|
|
|
|
|
Validation DOES NOT alter the input XML - it just tells you if it meets the Schema or not.
Why does it matter, anyway? Any conforming XML reader will convert the ' entity to an apostrophe when it reads it!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
But whenever a name with apostrophe comes the "flat file to XML" converter convert it to ' So the XML parser can't change it to apostrophe when it process it. What do i do to avoid it?
|
|
|
|
|
The XML parser will interpret the ' as an apostrophe and store it as such internally. The apostrophe is only converted to ' when written to the XML file.
The XML Standard[^] says that the apostrophe may be stored as ' to permit use in attribute values. By always translating an apostrophe to ' you make sure the apostrophe is always in a readable form.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
sorry friend, i meant whenever a name with apostrophe comes the "flat file to XML converter" converts it to &";apos instead of ' (please omit the double quotes). So the XML parser can't parse it to &apos.
|
|
|
|
|
Sounds like either the flat-files coming with entity encoding already done, or the converters doing the encoding twice. You can't fix that once you're in the XML domain - the original text might have been ' !
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Gives error access denied.
if i change MSXML2.serverXMLHTTP.4.0 to MSXML2.serverXMLHTTP then it gives error that soapaction.
here is my code
<%@language=Jscript%>
<%
var objSrvHTTP;
var objXMLSend;
var objXMLReceive;
var line="";
objSrvHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP.4.0");
objXMLSend = Server.CreateObject("Microsoft.XMLDOM");
objXMLReceive = Server.CreateObject("Microsoft.XMLDOM");
objXMLSend.async = false;
objFS = Server.CreateObject("Scripting.FileSystemObject");
ReadStream = objFS.OpenTextFile (Server.MapPath("BatchInput.xml"),1,false);
//ReadStream = objFS.OpenTextFile (Server.MapPath("Indulis.xml"),1,false);
var l="";
while (!ReadStream.AtEndOfStream) {
l=ReadStream.Readline();
line = line + l;
}
objSrvHTTP.setTimeouts(-1,-1,-1,-1) //This is important
//If this line is not there it will time out
//Before getting error back
objSrvHTTP.open ("POST","http://gems/GeneralLedgerTest/Update.asmx",false);
//objSrvHTTP.open ("POST","http://aura/GeneralLedger67/Update.asmx",false);
//objSrvHTTP.open ("POST","http://localhost/GeneralLedger/Update.asmx",false);
objSrvHTTP.setRequestHeader("Content-Type", "text/xml");
objSrvHTTP.setRequestHeader("SOAPAction","http://gems/Sample");
objSrvHTTP.send (line);
objXMLReceive = objSrvHTTP.responseXML;
Response.ContentType = "text/xml";
Response.Write (objXMLReceive.xml);
%>
my xml file is
<?xml version='1.0' encoding='utf-8'?>
<soap:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>
<soap:Body>
<LoadGLRequest xmlns='http://www.gemsgov.com/Request'>
<GLTransfer xmlns='http://www.gemsgov.com/Request'>
<GLLoadSchema xmlns='http://tempuri.org/GLLoadSchema.xsd'>
<GLBatch ORGANIZATION='001' EXSource='OHR' Sequence='0'>
<BatchHeader BatchDate='091009' AreaCode='' Operator='OHR' Sequence='1'>
<BatchDetails Account='01-00-00-1010-1010-00000
' Amount='-1214762.58' Description='TEST' GLType='PR' Grant='' Project='' ProjectTask='' WorkorderNumber='' WorkCode='' TransactionDate='082109' AltSource='PR' AltDetail='0001' Sequence='2' />
<BatchDetails Account='01-00-00-1310-0000-00072
' Amount='6769.25
' Description='TEST2' TransactionDate='082109' AltSource='PR' AltDetail='0002' Sequence='3' />
</BatchHeader>
</GLBatch>
</GLLoadSchema>
</GLTransfer>
</LoadGLRequest>
</soap:Body>
</soap:Envelope>
Please let e know asap.
Hemaxi
|
|
|
|
|
Dear All,
I have a combination of classic ASP page and asp.net pages in the application. I am getting this error "Microsoft VBScript runtime error '800a01a8' Object required" on a asp page.
The error is coming from this code:
sRawHtml = Request("h_RawHTML")
Set xd = Server.CreateObject("MSXML2.DOMDocument")
Call xd.loadXML(CStr(sEncrypteXML))
set xel = xd.selectSingleNode("//WebSiteInformation")
xel.setAttribute "Site_HTML", CStr(sRawHTML)
Please tell me if I have written something wrong.
Thanks,
SP
|
|
|
|
|
Which line gets the error ? Is the MSXML2.DOMDocument class present ( I think it's part of IE, so it should be, but that seems to me to be what the problem is ).
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi, the error is on the last line (xel.setAttribute "Site_HTML", CStr(sRawHTML)).
this is working for some HTML code passing thru sRawHTML; and not working for some other HTMLs
|
|
|
|
|
And is it possible you could post examples of working and not-working HTML? Or is it secret?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
This one is working properly
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="1" width="600" id="table1">
<tr>
<td>1</td>
<td>2</td>
<td>3</td>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
</tr>
<tr>
<td>10</td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</body>
</html>
|
|
|
|
|
...basically this one is giving the error...
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
</head>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">
<table border="0" width="680" bordercolor="#008080" id="table1" bgcolor="#33CCCC">
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font color="#FFFFFF"> Should extend up to touch bottom of Search Section </font>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font size="4">Template Test</font>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font size="2">980 pixels wide - variable length</font>
</td>
<td>
</td>
</tr>
<tr>
<td colspan="8">
<font color="#FFFFFF">< Should extend left to be flush with margin of banner and
Search Section</font></td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td colspan="8">
<p align="right">
<font color="#FFFFFF">Should extend right to be flush with margin of banner and Search
Section > </font>
</td>
</tr>
<tr>
<td>
</td>
<td colspan="8">
<p align="center">
<font color="#FFFFFF">v Should extend down to touch top of Footer Section
v</font>
</td>
<td>
</td>
</tr>
</table>
</body>
</html>
|
|
|
|
|
This one is not valid XML.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
OK, well, that's easy. xel is sometimes null. I notice you don't write code to check if it is.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi i had been using XercersDomParser for parsing the XML file in C++
I am not familiar with XML. In the follwing XML file
<?xml version="1.0" encoding="UTF-8"?>
<Locomotives>
<Locomotive xmlns="http://localhost:8080/source/schemas/locomotive.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:8080/source/schemas/locomotive.xsd http://localhost:8080/source/schemas/locomotive.xsd">
<LocoId>9001</LocoId>
<LocoRunNumber>UnReg</LocoRunNumber>
<LocomotiveGPSData>
<SampleTime>2008-07-13T13:37:33</SampleTime>
<Latitude>-32.86693333</Latitude>
<Longitude>151.75333333</Longitude>
<Speed>-1</Speed>
<Direction>-1</Direction>
<KmPostPosition>178500</KmPostPosition>
<TrackNumber>85</TrackNumber>
</LocomotiveGPSData>
<Events>
<Alarms>0</Alarms>
<Faults>0</Faults>
</Events>
</Locomotive>
<Locomotive xmlns="http://localhost:8080/source/schemas/locomotive.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost:8080/source/schemas/locomotive.xsd http://localhost:8080/source/schemas/locomotive.xsd">
<LocoId>9002</LocoId>
<LocoRunNumber>UnReg</LocoRunNumber>
<LocomotiveGPSData>
<SampleTime>2008-07-13T23:59:56</SampleTime>
<Latitude>-32.61888333</Latitude>
<Longitude>151.14988333</Longitude>
<Speed>-1</Speed>
<Direction>-1</Direction>
<KmPostPosition>239000</KmPostPosition>
<TrackNumber>87</TrackNumber>
</LocomotiveGPSData>
<Events>
<Alarms>0</Alarms>
<Faults>0</Faults>
</Events>
</Locomotives>
Eventhough i can traverse through XML file through
DOMTreeWalker but can't get idea to store Values in a strucured <list>
the structure look like this
typedef struct
{
Loco_Id LocoId ;
string /*DateTime*/ SampleTime ;
float Lattitude;
float Longitude;
float Speed ;
float Direction;
int KmPostPosition;
int TrackNumber;
int Alarms;
int Failures ;
}LocoDetails
Can any one tell how to access the value from the XML file and store to a list
|
|
|
|
|
There are a lot of ways to do it - here's some suggestions:
- The DOMTreeWalker lets you set up a node filter. You can set up a filter to accept all element nodes whose tag is Locomotive. That means that each call to the DOMTreeWalker's nextNode method will step to the next Locomotive element. For each of these, you iterate through the found element's child nodes. Each child's tag name indicates which struct memeber they relate to, while the child's text node is the value that you'll convert to the correct type using string conversion functions like strtol.
- From the root node, apply an XPath of "//Locomotive". That'll get you all the Locomotive elements, which you can process as above.
- Get a DOMElement for the root element of the XML document. Use the getElementsByTagName method to retrieve all descendent nodes with the tag naem Locomotive. Process each node as indicated above.
Hope that helps you!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
But still i am finding difficulty
could you please give me a example...............
|
|
|
|
|
VVVimal wrote: could you please give me a example
This[^] indicates this sample[^] which may be helpful, as well as many other pages.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
DOMElement* elementRoot = domDocumet->getDocumentElement();
DOMTreeWalker *walker =domDocumet->createTreeWalker(elementRoot,DOMNodeFilter::SHOW_ELEMENT,NULL, true);
DOMNode *pCurrent = NULL;
for ( pCurrent = walker->getCurrentNode();pCurrent != 0; pCurrent = walker->nextNode() )
{
if(pCurrent->getNodeType() == DOMNode::ELEMENT_NODE)
{
char *str = XMLString::transcode(pCurrent->getNodeName());
if(!strcmp(str,"LocoId"))
int i=0;
//myDetails->LocoId = XMLString::transcode(text->getNodeValue());
if(!strcmp(str,"Latitude"))
//myDetails->Lattitude = XMLString::transcode(text->getNodeValue());
XMLString::release(&str);
}
}
Could you please tell me where to set the filter as Locomotive
you also mentioned "From the root node, apply an XPath of "//Locomotive "
what does it mean
Thanks
you also mentioned as
|
|
|
|
|
Set the filter in the createTreeWalker method call.
VVVimal wrote: you also mentioned "From the root node, apply an XPath of "//Locomotive "
what does it mean
Using an XPath[^] library such as Xalan[^] or XQilla[^], you apply an XPath evaluator class to the DOM. That will give you an iterator that'll go through the nodes that match the XPath expression you gave to the XPath evaluator.
Read up on XPath - it's a very useful tool to know how to use.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
how do a code a button save a save file dialog must appear and a user must choose a location where to save in vb.net
|
|
|
|
|
If you would like an answer to this:
0) You need to use the VB .Net forum
1) Please don't double post, be patient and keep your posts together so people can see what has been suggested
2) You will need to show what you have already tried, and where it goes wrong. People won't write the code for you
3) Give as much detail as possible. You seemed to be on the right track with your last post, but we don't know how you're storing your XML in your code, how you want to store it on the disk, etc.
|
|
|
|
|
I already answered this question below. Please do not double post the same question.
|
|
|
|