Is there a way to modify the style sheet so that it transforms an XML document with empty tags as tag / ?

I have extracted some code from codeproject to
reindent an XML document. Does anyone know how I can modify the stylesheet to make it so that the transform of an XML file will result in empty tags showing up as <tag /> instead of <tag></tag>?
// http://www.codeproject.com/Articles/43309/How-to-create-a-simple-XML-file-using-MSXML-in-C
MSXML2::IXMLDOMDocumentPtr FormatDOMDocument(MSXML2::IXMLDOMDocumentPtr pDoc)
LPCSTR const static szStyleSheet =
R"!(<?xml version="1.0" encoding="utf-8"?>)!"
R"!(<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">)!"
R"!( <xsl:output method="xml" indent="yes"/>)!"
R"!( <xsl:template match="@* | node()">)!"
R"!( <xsl:copy>)!"
R"!( <xsl:apply-templates select="@* | node()"/>)!"
R"!( </xsl:copy>)!"
R"!( </xsl:template>)!"
R"!(</xsl:stylesheet>)!";
MSXML2::IXMLDOMDocumentPtr pXmlStyleSheet;
pXmlStyleSheet.CreateInstance(__uuidof(MSXML2::DOMDocument60));
pXmlStyleSheet->loadXML(szStyleSheet);
MSXML2::IXMLDOMDocumentPtr pXmlFormattedDoc;
pXmlFormattedDoc.CreateInstance(__uuidof(MSXML2::DOMDocument60));
CComPtr<IDispatch> pDispatch;
HRESULT hr = pXmlFormattedDoc->QueryInterface(IID_IDispatch, (void**)&pDispatch);
if (SUCCEEDED(hr))
_variant_t vtOutObject;
vtOutObject.vt = VT_DISPATCH;
vtOutObject.pdispVal = pDispatch;
vtOutObject.pdispVal->AddRef();
hr = pDoc->transformNodeToObject(pXmlStyleSheet, vtOutObject);
//By default it is writing the encoding = UTF-16. Let us change the encoding to UTF-8
// <?xml version="1.0" encoding="UTF-8"?>
MSXML2::IXMLDOMNodePtr pXMLFirstChild = pXmlFormattedDoc->GetfirstChild();
// A map of the a attributes (vesrsion, encoding) values (1.0, UTF-8) pair
MSXML2::IXMLDOMNamedNodeMapPtr pXMLAttributeMap = pXMLFirstChild->Getattributes();
MSXML2::IXMLDOMNodePtr pXMLEncodNode = pXMLAttributeMap->getNamedItem(_T("encoding"));
pXMLEncodNode->PutnodeValue(_T("UTF-8")); //encoding = UTF-8
return pXmlFormattedDoc;
Or, if there is some other method for reindenting a MSXML2::IXMLDOMDocumentPtr object where I can specify how I want empty tags to be stored, that would be great too.  However, I don't want it to lose its status of an MSXML2::IXMLDOMDocumentPtr object.
 I.e. I would like to still perform operations on the result as if it was still an MSXML2::IXMLDOMDocumentPtr object.
Thanks,
A
Adrian

If anyone is interested, I got an answer on StackOverflow
here.
Adrian

Similar Messages

  • Is there any way to create a style sheet in APEX?

    Hi experts,
    I am in I am in Oracle Enterprise Manager 11g 11.2.0.1.0.
    Is there any way to create a style sheet in APEX any version?
    I want to create a style sheet and use APEX report column link to it.
    Thanks.
    Cow

    Well, if that is the case, then you'll need to do some PL/SQL programming to write a package to create all of that for you, then execute the package when the 'link' column is clicked.
    After your package is written, change the attributes on your link column to be a URL instead of page in your application and call it like:
    javascript:{MypopUp2('http://your.server.name/print/owner.package_name.sub_procedure?key=#COL01#',800,600);}
    On my system, I created a new DAD and user just for this one purpose, to read an select the information in my report, generate the HTML to display the data, etc. without leaving a loophole someone could exploit to get direct data manipulation access. My report though is a form-type report of all the data from about 40 tables for that one 'master' record, with css formatting included. I'm not directly generating a css file based upon data within the database, but simply adding the css formatting into the HTML file my package generates.
    Does this help your problem?
    Bill Ferguson

  • Adobe Reader 11.0.07 defaults to duplex printing. Is there a way to set the default to leave that "print to both sides of the page" box unchecked?

    Adobe Reader 11.0.07 defaults to duplex printing. Is there a way to set the default to leave that "print to both sides of the page" box unchecked?
    I am working on an end-user's computer, I just updated to the newest Adobe Reader and they don't ever print duplex. I want to be able to have the "print to both sides" box unchecked on the print dialog by default. Is there a way to do this? I have the printer settings all set to 1-sided but it is adobe print dialog settings that keep messing it up.
    Thanks!

    Hi John,
    Have you tried repairing Reader and checked?
    Does this issue occur only on this machine or are you facing the issue with other computers as well which have updated to Reader 11.0.10?
    Regards,
    Anoop

  • Is there a way to know the qualifier or qualifers that were applied

    Hi All,
    If I have a promotion like this Buy2 get 2 is there a way to know the qualifier or qualifiers that were applied?
    I will end up by having 4 commerce Items and two will be free with an adjustment of the promotion that was applied, but I do not know which items were the ones that make that possible
    is there a way to know that?
    Which items were used to get a BOGO or BuyXGetY?
    Regards,
    Obed

    Hi All,
    If someone needs to know this in the future
    findQualifyingItems() is the one in charge of knowing which items had promotions and it calls a method called evaluateQualifier wihch "can" contain a List of items that are the ones that were used to apply a promotion like BOGO or BuyXGetY.
    Basically the solution for me was override QualifierService and
    @Override
         public Collection findQualifyingItems(PricingContext pPricingContext,
                   Map pExtraParametersMap)
    In order to save the info in a Map I am using CommerceItemMarkers http://docs.oracle.com/cd/E35318_02/Platform.10-1-1/ATGCommStoreGuide/html/s1401usingorderandcommerceitemmarkers01.html
    And now I have my business requirement covered thanks to this.
    Regards,
    Obed
    Edited by: obedmhg on May 17, 2013 2:53 PM

  • My old computer died and I got just got a new one.  Is there any way to access the movies, apps, etc. that I bought on i tunes on this new computer?

    my old computer died and I got just got a new one.  Is there any way to access the movies, apps, etc. that I bought on i tunes from the new computer?

    Yes....
    On the new computer, launch iTunes. From the menu bar click click Store / Authorize This Computer.
    Then re download your iTunes purchases.
    Downloading past purchases from the App Store, iBookstore, and iTunes Store

  • [CS2 on Windows XP]: Is there a way to modify the JPG compression in an SVG?

    Hello,
    I have got an EPS file.It contains some text, some paths, and a rastered image.
    Saved as a JPG with moderate compression it is 125KB in size. For an EPUB I want to insert is as an SVG. But when I save it as an SVG (text being converted to paths) it is over 600 KB and thus exeeding the 300k limit that exists for files within an EPUB container.
    Is there a way to have the JPG stream in the SVG more compressed? The W3C spec of the SVG format doesn't say anything about a fixed compression level, so I guess the compression can be varied. But Illustrator CS2 doesn't seem to have any appropriate setting.
    Best regards,
    Christian Kirchhoff

    If anyone is interested, I got an answer on StackOverflow
    here.
    Adrian

  • Is there any way to modify the photo book size after I have created the book?

    I created a photo book then realized it was not the correct size. Is there a way to correct the size or do I have to start from scratch?
    I Found the answer after I posted this- CTRL D to duplicate, then choose new theme - Worked like a charm.

    Yes.  First click on the book in the Projects section and type Command +D (duplicate).  Open the book, click on Change Themes and in the next window select the size and type you want.
    The duplicate is to have in case you find any text that was removed in the resizing.  You can cut and past from the duplicate copy to the original.  Also verify that the resized book has all of its text, not text warning indicators and that all photos are there and in the correct order.
    Always create a PDF version of the book according to this Apple doucment, iPhoto, Aperture: Previewing an order in iPhoto or Aperture, to check for any errors, i.e. typos, missing text, etc., before ordering the book.  Keep the pdf file to compare with the printed version when it arrives.
    Opps!  Answered your question from the title without reading the full body of your post. However, the last 2 paragraphs are worth reviewing.
    OT
    Message was edited by: Old Toad

  • Is there any way to get the server app other that through the app store. We do not have our system conneted to a network. I typical downloaded items on a non-apple system.

    is there any way to get the server app other than through the app store. The system that I need it on are not connected to the internet.
    We run a closed-loop network of apple systems and I tipically downloaded updates on a non-apple system that was on the internet.
    Any ideas?

    I did buy the server app, went to the app store to download it. This system I'm using for downloads is Snow Leopard 10.6.8, it shows that I can download it but only as an Install which says I need 10.8. I can't seem to find a way for it to just download as a package or .dmg file so that I can copy it to DVD/CD or flash drive.

  • Is there any way to limit the number of times that a PDF can be opened?

    I run a small publishing company and we want to provide exam copies of our books to professors.  At present our exam copies have the words EXAM COPY as a water mark on every page and we've also made the files so that they can't be printed or easily copied.  However, we'd like to also restrict these PDFs so that they can only be opened 5 times.  I've read about FileOpen but that approach seems a bit more complex than needed.  Is there any other way to restrict the number of times that a PDF file can be opened once it is downloaded?  Thanks in advance for any suggestions.

    DRM soltions like FileOpen are your best bet for PDFs. Others include Adobe's LiveCycle Rights Managment, LockLizard, Armjisoft PDF Security OwnerGuard, etc.
    They all work and are priced differently, but there's really nothing for what you want to do that is both simpler and secure.

  • Is there a way to prevent the No Sender emails that flood my email?  I know how to get rid of them but I want to prevent them.

    IIs there a way to PREVENT the No Sender emails?  I know how to delete them but I don't want them at all.

    Knitnutty
    To help other members answer your question, give as many details as you can.
        •    Include your product name and specs such as processor speed, memory, and storage capacity. Please do not include your Serial Number, IMEI, MEID, or other personal information.
        •    Provide the version numbers of your operating system and relevant applications, for example "iOS 6.0.3" or "Mail 10.x".
        •    Describe the problem, and include any details about what seems to cause it.
        •    List any troubleshooting steps you've already tried, or temporary fixes you've discovered.
    I know this sounds like a bunch stuff, but we need to know many things before we can get our minds around your system, so then we maybe can help your with filtering these some.
    Include also:
    Who is your email provider? DO NOT post your email address!!
    Did this just begin recently? Always? If recent, what can you think of that has changed recently?
    CCC

  • Is there a way to modify the name displayed in the Title Bar at the top of the Audition Window?

    It's not uncommon for me to have a copy of Audition versions 1.5, 2.0 and 3.0 all open at the same time if I'm doing some editing for a complex project. 
    It would be handy for me to quickly see which window I have open without having to recognise the icons of the different versions.  At the moment, each Title Bar just displays the Audition icon and the words "Adobe Audition".  I'd like to add the version number to the name, if it's possible.  I'm happy to edit the Windows Registry, if that is what is needed.
    Does anybody know where the Title Bar information is stored?

    I have an answer you might like Howard.
    You could simply export one title to a PRTL file, then duplicate it using an Excel VB macro to change the name of the file based on a list in an excel file. You could type in a couple of dates, then just drag down to the 365th row and all of the dates would be there waiting for the macro to rename the file. Then, if you are really talented, you could find the appropriate text in the XML file and change it to match the name of the title, but without the PRTL extension.
    That way the font and position and style would all be right and the effort would be in a file you could share with the world.
    Hmmm. I might have to try that myself one of these days. Could come in handy. If you are more comfortable with Word than Excel, create the dates in Excel and paste them into a table in Word. Just be careful not to mess up the
    Edit: Oh, and of course, you import the titles back into Premiere Pro.

  • Is there a way to modify the schema-mapped XML that is generated by the submit action prior to submission?

    I have a form created in LiveCycle ES2. I have mapped some fields to a schema that causes LC to generate XML that adheres to the import format of one of my company's internal databases.
    There is one problem: the system's import function looks for a DTD DOCTYPE declaration between the XML declaration and root element. I've tried including the declaration in the schema, but LC does not include it in the mapped values or the export. I've spoken with the vendor about declaring the DTD as part of the import function and they have given a firm "No."
    Is there a way to insert one line of markup into the XML that LC generates in the submit action before the XML is attached to the e-mail?

    Thanks for pointing me at those. Worked like a charm. My stylesheet ended up looking like this (in case anyone is curious later on):
    <?xml version="1.0" encoding="UTF-8"?>
        <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
            <xsl:template match="/">
                <xsl:text disable-output-escaping="yes">
    &lt;!DOCTYPE name SYSTEM "http://location/DTD/name.dtd"[]&gt;
                </xsl:text>
                <xsl:copy-of select="root node"/>
            </xsl:template>
        </xsl:stylesheet>

  • Is there a way to modify the bass levels that are output from the built in iMac speakers?

    For example, in the settings of the iPhone, you can change the EQ to Bass Boost. Is there such an option on the iMac?

    It's here in iTunes 11:

  • Is there a way to change the date format so that delegates have to choose a day, month and year from a drop down menu as my delegates keep forgetting to change the year of their information

    When my delegates are filling in a event form i have put together, a large number of them forget to change either the month or year on the date field. Is there a way to have a date field that has drop down boxes for day, month and year so they have to choose rather than a date been already on the screen??
    Thanks

    Hi Christopher,
    The WEEKDAY function allows specifying either Sunday or Monday as the first day of the week:
    WEEKDAY
    The WEEKDAY function returns a number that is the day of the week for a given date. WEEKDAY(date, first-day)
      date:  The date the function should use. date is a date/time value. The time portion is ignored by this function.
      first-day: An optional value that specifies how days are numbered.
    Sunday is 1 (1 or omitted):  Sunday is the first day (day 1) of the week and Saturday is day 7.
    Monday is 1 (2):  Monday is the first day (day 1) of the week and Sunday is day 7. Monday is 0 (3):  Monday is the first day (day 0) of the week and Sunday is day 6.
    But I think you are referring to the first day of the 'workweek', for which I do not see a means of defining a custom value.
    Since you want to 'insert categories', though, you could easily define your own, using WEEKDAY(date) or WEEKDAY(date,1), plus an IF statement to return the category label appropriate to the day. Here's one for a Sunday to Thursday work week. Dates are in column A, the formula is in whichever column you want as the Category column. For the example, I've placed it in column B.
    B2, and filled down: =IF(WEEKDAY(A)<6,"Work","Off")
    The top table shows the weekday numbers returned for each day of the week for each of the three permitted values for the optional second argument. The bottom table shows the results from the formula above, used to define a category label for each date:
    A10 was left blank intentionally, to determine if the lack of data resulted in an error. The Warning message, flagged by the blue 'warning' triangle, is "The formula uses a number in place of a date." The 'date' assigned to this numerical value of zero was a Friday, but I'm not certain when. Probably best to avoid extra rows with no date shown.
    Regards,
    Barry

  • Is there a way to Point the Exact Location for an Error In an XML File?

    Dear Members,
    I am validating an XML File with an XML Schema. The XML Schema is in the Database.
    I am using presently isschemavalid to check for the validity of the XML File.
    But this is not showing where the error is there in the XML File.
    Is there any way where I can check this one...(Validation should happend only in the Database side)
    Regards
    Madhu K

    Read about advantages of [url http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14259/xdb03usg.htm#sthref315]schemaValidate  method over isSchemaValid.
    Best regards
    Maxim

Maybe you are looking for