|
Hi All,
I am trying to display an image in an HTML page by inserting an IMG tag and specifying the SRC attribute in it. Now the source of the image is specified in the XML file but in the format
url('http://www.somewebsite/image/myimage.jpg')
now when I tried to insert the value of the element from the XML file it gdoes not displayes the image as it does not recognises the url keyword. I also tried it with style="behaviour:url('')" but it is not working. Is it possible to display the image.
|
|
|
|
|
Hi,
If you are saying that you have some xml that is a bit like either :
<sometag>url('http://www.somewebsite/image/myimage.jpg')</sometag>
or :
<sometag someattr="url('http://www.somewebsite/image/myimage.jpg')" />
If you are using XSLT then you could trim the outer parts of the string using a combination of string functions from: string-length() , substring() , substring-before() , and substring-after()
or maybe just two consecutive calls to translate() would do it.
You could just output the value of whats left over into the src attribute
This probably isn't very efficient (string functions), if you have to do it a lot, but if thats whats in the xml you might have to resort to something like this.
Cheers
Phil Hobgen
barbari.co.uk
Southampton, UK
|
|
|
|
|
Thanks Phil,
It worked. Thanks a lot for this.
|
|
|
|
|
The scheme, which is out in a file, can be redefined by the XML document itself. I guess what unsettles me about this is it allows the sender to redefine what is valid. My database may not be able to store the additional properties added by the redefined scheme, but both the sending parser and receiving parser will accept the new properties because embedded in the XML document is a redefine section. I have no control over what the sender may redefine.
Am I misunderstanding something here? Is this a good thing?
thanks
|
|
|
|
|
I have a project for someone familiar with using XML Native Databases. I need to extract data from an XML file that drives one piece of equipment and insert it into an existing TXT file that drives another piece of equipment. Both files are generated simulatneously by my design software to drive competing pieces of equipment but the XML file is richer and has more data. Is this the appropriate forum to find a programmer who might be interested in completing this project?
Steve Bumbalough
WallPanelDesign,LLC
|
|
|
|
|
HOW to get start with xml parser.
|
|
|
|
|
Google?
Now seriously. Do you want to write your own parser or use some already created parser? If first one is the case, read up about parsers... e.g. here on CP like http://www.codeproject.com/cpp/yard-xml-parser.asp[^] or others. You may want to study XML spec. (http://www.w3.org/TR/2004/REC-xml-20040204/[^])
If latter, give more info please, like what parser do you want to use, in what language and what features do you need. CP/Google will help you as well.
Does it help? You can allways ask for more...
p.s. more keywords ( not only obvious "XML, Parser") are "Token, Grammar"
I'd love to help you more, but these days I am struggling with my own HTML parser (and with math, but this is different story ), so I don't spent so much time here now... hopefully somebody else will help you more (hey Phil, it's time to show off :->)
best regards
David 'DNH' Nohejl
Never forget: "Stay kul and happy" (I.A.)
|
|
|
|
|
|
Hi all,
Can anyone help me out by showing a small piece of code on how to use fo:bookmark-tree and fo:bookmark. I am using FOP 0.20.5 to create the PDF. I tried out an example but it gave error specifying that no such tag as fo:bookmark-tree.
|
|
|
|
|
Hi All,
I am trying to implement
<fo:inline background-color="yellow">My Text</fo:inline>
But while creating my PDF with FOP 0.20.5, my background color does not change. Is there a work around for this.
|
|
|
|
|
hi,
i couldnt able to add a new element to a xml document using VC++ 6.0. im getting problem in appendChild function. if anyone having samples plz send it to kannaa_ram@yahoo.com
thanks and regards
kannan
|
|
|
|
|
I want to serialize (write) a DOM document out in an XML document.
1.How can i write <?xml version="1.0" encoding="UTF-8"?> and <!DOCTYPE rootElement SYSTEM "URIreference.dtd"> to the local file.
|
|
|
|
|
ladies & gentlemen.
i'm new in xerces xml dom. can anyone help me with following:
how can i get the XML content of the DOMDocument (as in msxml)?
there methods like, getTextContent... but it returns text without tags.
i've seen that java implemantation of xerces has DOMSerializer object.
maybe there is any analogical object...
any ideas?
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
int main(int argc, char **argv)
{
int errorCount = 0;
try
{
XMLPlatformUtils::Initialize();
}
catch(const XMLException& toCatch)
{
cout << "XMLPlatformUtils::Initialize() failed." << endl;
XMLPlatformUtils::Terminate();
}
std::auto_ptr<xercesdomparser> pXercesDOMParser(new XercesDOMParser());
std::auto_ptr<mydomtreeerrorreporter> errReporter(new myDOMTreeErrorReporter());
pXercesDOMParser->setErrorHandler(errReporter.get());
XercesDOMParser::ValSchemes valScheme = XercesDOMParser::Val_Auto;
pXercesDOMParser->setValidationScheme(valScheme);
try
{
char filename[] = "config/command.xml";
pXercesDOMParser->parse(filename);
errorCount = pXercesDOMParser->getErrorCount();
if (errorCount > 0)
{
cout << "open file failed. 0" << endl;
XMLPlatformUtils::Terminate();
//goto Exit;
return 0;
}
}
catch (const DOMException& e)
{
cout << "open file failed. 1" << endl;
XMLPlatformUtils::Terminate();
return 0;
}
catch (const XMLException& e)
{
cout << "open file failed. 2" << endl;
XMLPlatformUtils::Terminate();
return 0;
}
DOMNode *pDOC = pXercesDOMParser->getDocument();
DOMNode *pNode = pDOC->getFirstChild();
//std::string name(getProp(pNode, "?xml"));
for (pNode = getNextElementNode(pNode);
pNode != NULL;
pNode = getNextElementNode(pNode))
{
/*if (!UtilXML::matchNode(pNode, "dictionary");
if (!matchNode(pNode, "dictionary"))
{
cout << "Bad dictionary format." << endl;
break;
}
std::string proto(getProp(pNode, "protocol"));
int currentProtocol = atol(proto.c_str());
#ifdef _DEBUG
cout << "protocol = " << currentProtocol << endl;
#endif
parseDictionary(pNode->getFirstChild(), currentProtocol);
*/
if(!matchNode(pNode, "command"))
{
cout << "Bad command format." << endl;
break;
}
parseCommand(pNode, 0);
}
//Exit:
pXercesDOMParser.release();
errReporter.release();
XMLPlatformUtils::Terminate();
return 0;
}
|
|
|
|
|
thx a lot. thats not really what i meant. but i find it helpful too.
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
I have an XML File:
<ROOT>
<CAR Name="Maruti">
<SALES Year="2000">10</SALES>
<SALES Year="2001">11</SALES>
<SALES Year="2002">9</SALES>
<SALES Year="2004">8</SALES>
</CAR>
<CAR Name="Fort">
<SALES Year="2000">8</SALES>
<SALES Year="2002">7</SALES>
<SALES Year="2003">6</SALES>
<SALES Year="2004">9</SALES>
</CAR>
<CAR Name="Mercedes">
<SALES Year="2000">2</SALES>
<SALES Year="2001">4</SALES>
<SALES Year="2003">6</SALES>
<SALES Year="2004">3</SALES>
</CAR>
</ROOT>
Now I want to print the sales of each car Year wise in a tabular format. Something like a pivot table. If the car does not have sales for a particular year, it should display blank space. The output should be in the format like:
Maruti Fort Mercedes
2000 10 8 2
2001 11 - 4
2002 9 7 -
2003 - 6 6
2004 8 9 3
I am not able to print the values particularly. Please help.
|
|
|
|
|
Hi,
This doesn't seem like a very elegant solution. I'm sure there must be a better way, but I couldn't get there
Hope this helps.
<?xml version="1.0" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:variable name="unique-years" select="/ROOT/CAR/SALES[not(@Year=preceding::*/@Year)]/@Year" />
<xsl:variable name="unique-carnames" select="/ROOT/CAR[not(@Name=preceding::*/Name)]/@Name" />
<html>
<body>
<table>
<tr>
<td> </td>
<xsl:for-each select="$unique-carnames">
<xsl:sort select="." />
<td><xsl:value-of select="." /></td>
</xsl:for-each>
</tr>
<xsl:for-each select="$unique-years">
<xsl:sort select="." />
<tr>
<xsl:variable name="this-year" select="."/>
<td><xsl:value-of select="$this-year" /></td>
<xsl:for-each select="$unique-carnames">
<xsl:sort select="." />
<xsl:variable name="this-car" select="."/>
<td><xsl:value-of select="/ROOT/CAR[@Name=$this-car]/SALES[@Year=$this-year]" /></td>
</xsl:for-each>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Cheers
Phil Hobgen
barbari.co.uk
Southampton, UK
|
|
|
|
|
Thanks a lot Phil. It works.
|
|
|
|
|
I am a beginner of xml programming.
I am going to transmission an image file, a text file and a video file through TCP/IP. Therefore, I want to group them by a xml file.
I don't know how to get start on it.
Can someone show me some guidelines?
Please help
|
|
|
|
|
Hi,
The best place to start is with some questions :
1) What's your development environment?
2) Is there an existing XML Schema that you need to comply with? If you are exchanging the data with an external system, a schema is useful as a definition of the exchanged data format. Alternatively you may just be able to agree a simple xml structure.
3) Do you need to enclose the binary data in the xml, or could you use a url within the xml to indicate where the binary data can be retrieved from? If you need to enclose the binary data then you will need to encode it, as xml does not allow binary data. Note that this encoding will expand the size of the binary data, and hence the size of your xml.
4) When you transmit via TCP/IP do you mean HTTP, a web service, or some other standard protocol or just from port to port using some 'informal' protocol?
A good link to bookmark is http://www.zvon.org[^]
Good Luck!
Cheers
Phil Hobgen
barbari.co.uk
Southampton, UK
|
|
|
|
|
Thank you for your reply. It is very helpful for me.
I am programming with C#.net in XP.
Moreover, I am using "TCPListener" and "TCPClient" and the data are transmitted by "StreamWriter" and "StreamReader".
-Can XML Schema be used in non-website case?
-I am not using web service. Can SOAP be used for binary data encoding?
If not, what should I use?
Regards
|
|
|
|
|
Hi,
XML can be used anywhere where you can use text. You can pass it around in files, or over the web. SOAP is a protocol that uses XML for sending/receiving to call methods, this doesn't sound like what you want.
To do the binary encoding take a look at base64 encoding.
Cheers
Phil Hobgen
barbari.co.uk
Southampton, UK
|
|
|
|
|
Hi,
I solve it. I learn a lot. Thank You.
Cheers
RockRock
|
|
|
|
|
Can somebody give me a GOOD START on XMI - Just the Basics.
I tried to get some information on What XMI is and its intended use, but did not get any useful information.
All I know of it is that it is an XML-based, stream representation of a UML model which has the potential to allow models to be shared between different UML tools.
I find tools to convert XMI to UML and vice versa, but no good start on what XMI is, what is it used for? The future of XMI or in other words, will it have a widespread use as XML has today.
I am told it would take the place of UML soon - How true is this Statement?
|
|
|
|
|
Hi,
A starting point would be the OMG web site generally, and maybe this page http://www.omg.org/technology/xml/index.htm[^] in particular.
From what I know, it's just an XML language for describing UML models so they can be exchanged between different vendors modelling tools. It can't take the place of UML as it is just a standard language for describing UML models. As for its' future - personally I can't see much call for it in the real world, except maybe for large open source projects where a number of different UML editors might be used by different contributors. From my experience organisations tend to standardise on the use of a single modelling tool, so unless they want to exchange models externally they would have no call for XMI.
I have no real idea, but perhaps it is possible be that certain vendors would like to use XMI to store the models generated by their modelling tools, however xml would seem to be an extremely inefficient way to store this data. A bit like storing very large spreadsheets as XML, only worse!
It would be interesting to hear what started your interest in XMI?
Cheers
Phil Hobgen
barbari.co.uk
Southampton, UK
|
|
|
|